package com.tencent.service;

import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;

import com.tencent.common.Configure;
import com.tencent.protocol.unifiedorder_protocol.UnifiedorderReqData;
import com.tencent.protocol.unifiedorder_protocol.UnifiedorderReqDataApp;

/**
 * 商户系统先调用该接口在微信支付服务后台生成预支付交易单，返回正确的预支付交易回话标识后再在APP里面调起支付
 * @author wuhao
 * date 2016-07-01
 * 接口详情见：
 * https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_1
 */
public class UnifiedorderService extends BaseService {

	public UnifiedorderService() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
		super(Configure.UNIFIEEDORDER_API);
	}

	/**
	 * 请求统一下单
	 * @param unifiedorderReqData 请求参数对象
	 * @return
	 * @throws Exception
	 */
	public String request(UnifiedorderReqData unifiedorderReqData) throws Exception {
		String responseString = sendPost(unifiedorderReqData);
		return responseString;
	}

	public String request(UnifiedorderReqDataApp unifiedorderReqData) throws Exception{
		String responseString = sendPost(unifiedorderReqData);
		return responseString;
	}
}
